package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsCouponSpuCategoryRelation;
import com.wuxiaofan.coupon.entity.custom.SmsCouponSpuCategoryRelationCustom;
import com.wuxiaofan.coupon.mapper.SmsCouponSpuCategoryRelationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsCouponSpuCategoryRelationService {
    @Autowired
    private SmsCouponSpuCategoryRelationMapper smsCouponSpuCategoryRelationMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsCouponSpuCategoryRelation findById(String id){
        return smsCouponSpuCategoryRelationMapper.selectById(id);
    }

    public SmsCouponSpuCategoryRelationCustom findCountByMap(Map paraMap){
        return smsCouponSpuCategoryRelationMapper.findCountByMap(paraMap);
    }

    public SmsCouponSpuCategoryRelationCustom findGroupByMap(Map paraMap){
        return smsCouponSpuCategoryRelationMapper.findGroupByMap(paraMap);
    }

    public List<SmsCouponSpuCategoryRelationCustom> findByMap(Map paraMap){
        return smsCouponSpuCategoryRelationMapper.findByMap(paraMap);
    }

    public Page<SmsCouponSpuCategoryRelationCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsCouponSpuCategoryRelationMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsCouponSpuCategoryRelationMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsCouponSpuCategoryRelationMapper.deleteById(id);
    }

    public SmsCouponSpuCategoryRelation save(SmsCouponSpuCategoryRelation smsCouponSpuCategoryRelation){
        smsCouponSpuCategoryRelation.setId(idgenerator.getId());
        smsCouponSpuCategoryRelationMapper.insert(smsCouponSpuCategoryRelation);
        return smsCouponSpuCategoryRelation;
    }

}
